import backend, models, managers, options, serializers


init_ldap_server = """
>>> from django.conf import settings
>>> import ldap
>>> from ldap.modlist import addModlist
>>> l = ldap.open(settings.LDAP_SERVER)
>>> r = l.simple_bind_s(settings.LDAP_BIND_DN,settings.LDAP_BIND_PWD)
>>> from ldif import LDIFParser
>>> class InitLdifParser(LDIFParser):
...  def handle(self, dn, entry):
...    l.add_s(dn,addModlist(entry))
>>> from fixtures import init_ldif
>>> import StringIO
>>> parser = InitLdifParser(StringIO.StringIO(init_ldif))
>>> parser.parse()
"""

finalize_ldap_server = """
>>> from django.conf import settings
>>> import ldap
>>> from ldap.modlist import addModlist
>>> l = ldap.open(settings.LDAP_SERVER)
>>> r = l.simple_bind_s(settings.LDAP_BIND_DN,settings.LDAP_BIND_PWD)
>>> l.manage_dsa_it(1)
>>> dns = []
>>> from ldif import LDIFParser
>>> class FinalizeLdifParser(LDIFParser):
...  def handle(self, dn, entry):
...    dns.append(dn)
>>> from fixtures import init_ldif
>>> import StringIO
>>> parser = FinalizeLdifParser(StringIO.StringIO(init_ldif))
>>> parser.parse()
>>> dns.reverse()
>>> for dn in dns:
...  r = l.delete_s(dn)
"""
__test__ = {
    '1_init_ldap_server': init_ldap_server,
    'backend': backend,
    'models': models,
    'managers': managers,
    'options': options,
    'serializers': serializers,
    'z_finalize_ldap_server': finalize_ldap_server,
}

